﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CommonExtensions.ObjectExtensions;
using CommonExtensions.StringExtensions;
using DBMigrator.Core.DbObjects.Column;

namespace DBMigrator.Core.DbObjects.Table
{
    public abstract class Table : ITable
    {
        public abstract Type SqlGenerationType { get; }
        public IList<ITableChange> Changes { get; private set; }
        public string Name { get; protected set; }

        protected Table(string name)
        {
            if(name.IsBlank())
                throw new ArgumentNullException("Name");

            Name = name;
        }

        public IAddColumn<TColumn> AddColumn<TColumn>(string name)
        {
            if(name.IsBlank())
                throw new ArgumentNullException("name");

            var column = new AddColumn<TColumn>(name);
            Changes.Add(column);
            return column;
        }
    }
}
